home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / xml / gnome / xslt / docbook / html / db2html-l10n.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2009-03-17  |  6.1 KB  |  164 lines

  1. <?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
  2. <!--
  3. This program is free software; you can redistribute it and/or modify it under
  4. the terms of the GNU Lesser General Public License as published by the Free
  5. Software Foundation; either version 2 of the License, or (at your option) any
  6. later version.
  7.  
  8. This program is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  11. details.
  12.  
  13. You should have received a copy of the GNU Lesser General Public License
  14. along with this program; see the file COPYING.LGPL.  If not, write to the
  15. Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  16. 02111-1307, USA.
  17. -->
  18.  
  19. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  20.                 xmlns:msg="http://www.gnome.org/~shaunm/gnome-doc-utils/l10n"
  21.                 xmlns="http://www.w3.org/1999/xhtml"
  22.                 exclude-result-prefixes="msg"
  23.                 version="1.0">
  24.  
  25. <!--!!==========================================================================
  26. DocBook to HTML - Localization Formatters
  27.  
  28. REMARK: Document this module
  29. -->
  30.  
  31. <!--**==========================================================================
  32. l10n.format.span
  33. FIXME
  34. $node: The node in the original document being processed
  35. $span: The #{msg:span} element in the localized formatter
  36. $font_family: The font family to render the text in
  37. $font_style: The font style, generally used for #{italic}
  38. $font_variant: The font variant, generally used for #{small-caps}
  39. $font_stretch: The amount to stretch the font
  40. $font_size: The size of the text
  41. $text_decoration: The decoration on the text, generally used for #{underline}
  42.  
  43. REMARK: Talk a lot about this, including a specification of what each of
  44. the parameters can do.
  45. -->
  46. <xsl:template name="l10n.format.span">
  47.   <xsl:param name="node"/>
  48.   <xsl:param name="span" select="."/>
  49.   <xsl:param name="font_family"     select="string($span/@font-family)"/>
  50.   <xsl:param name="font_style"      select="string($span/@font-style)"/>
  51.   <xsl:param name="font_variant"    select="string($span/@font-variant)"/>
  52.   <xsl:param name="font_weight"     select="string($span/@font-weight)"/>
  53.   <xsl:param name="font_stretch"    select="string($span/@font-stretch)"/>
  54.   <xsl:param name="font_size"       select="string($span/@font-size)"/>
  55.   <xsl:param name="text_decoration" select="string($span/@text-decoration)"/>
  56.   <span>
  57.     <xsl:attribute name="style">
  58.       <xsl:if test="$font_family != ''">
  59.         <xsl:value-of select="concat('font-family: ', $font_family, '; ')"/>
  60.       </xsl:if>
  61.       <xsl:if test="$font_style != ''">
  62.         <xsl:value-of select="concat('font-style: ', $font_style, '; ')"/>
  63.       </xsl:if>
  64.       <xsl:if test="$font_variant != ''">
  65.         <xsl:value-of select="concat('font-variant: ', $font_variant, '; ')"/>
  66.       </xsl:if>
  67.       <xsl:if test="$font_weight != ''">
  68.         <xsl:value-of select="concat('font-weight: ', $font_weight, '; ')"/>
  69.       </xsl:if>
  70.       <xsl:if test="$font_stretch != ''">
  71.         <xsl:value-of select="concat('font-stretch: ', $font_stretch, '; ')"/>
  72.       </xsl:if>
  73.       <!-- FIXME: make font size able to use our 1.2 scale? -->
  74.       <xsl:if test="$font_size != ''">
  75.         <xsl:value-of select="concat('font-size: ', $font_size, '; ')"/>
  76.       </xsl:if>
  77.       <xsl:if test="$text_decoration != ''">
  78.         <xsl:value-of select="concat('text-decoration: ', $text-decoration, '; ')"/>
  79.       </xsl:if>
  80.     </xsl:attribute>
  81.     <xsl:apply-templates mode="l10n.format.mode">
  82.       <xsl:with-param name="node" select="$node"/>
  83.     </xsl:apply-templates>
  84.   </span>
  85. </xsl:template>
  86.  
  87. <!--#% l10n.format.mode ==================================================== -->
  88.  
  89. <xsl:template mode="l10n.format.mode" match="msg:span">
  90.   <xsl:param name="node"/>
  91.   <xsl:call-template name="l10n.format.span">
  92.     <xsl:with-param name="node" select="$node"/>
  93.     <xsl:with-param name="span" select="."/>
  94.   </xsl:call-template>
  95. </xsl:template>
  96.  
  97. <xsl:template mode="l10n.format.mode" match="msg:b">
  98.   <xsl:param name="node"/>
  99.   <xsl:call-template name="l10n.format.span">
  100.     <xsl:with-param name="node" select="$node"/>
  101.     <xsl:with-param name="font_weight" select="'bold'"/>
  102.   </xsl:call-template>
  103. </xsl:template>
  104.  
  105. <xsl:template mode="l10n.format.mode" match="msg:big">
  106.   <xsl:param name="node"/>
  107.   <xsl:call-template name="l10n.format.span">
  108.     <xsl:with-param name="node" select="$node"/>
  109.     <xsl:with-param name="font_size" select="'1.2em'"/>
  110.   </xsl:call-template>
  111. </xsl:template>
  112.  
  113. <xsl:template mode="l10n.format.mode" match="msg:i">
  114.   <xsl:param name="node"/>
  115.   <xsl:call-template name="l10n.format.span">
  116.     <xsl:with-param name="node" select="$node"/>
  117.     <xsl:with-param name="font_style" select="'italic'"/>
  118.   </xsl:call-template>
  119. </xsl:template>
  120.  
  121. <xsl:template mode="l10n.format.mode" match="msg:sub">
  122.   <xsl:param name="node"/>
  123.   <sub>
  124.     <xsl:apply-templates mode="l10n.format.mode">
  125.       <xsl:with-param name="node" select="$node"/>
  126.     </xsl:apply-templates>
  127.   </sub>
  128. </xsl:template>
  129.  
  130. <xsl:template mode="l10n.format.mode" match="msg:sup">
  131.   <xsl:param name="node"/>
  132.   <sup>
  133.     <xsl:apply-templates mode="l10n.format.mode">
  134.       <xsl:with-param name="node" select="$node"/>
  135.     </xsl:apply-templates>
  136.   </sup>
  137. </xsl:template>
  138.  
  139. <xsl:template mode="l10n.format.mode" match="msg:small">
  140.   <xsl:param name="node"/>
  141.   <xsl:call-template name="l10n.format.span">
  142.     <xsl:with-param name="node" select="$node"/>
  143.     <xsl:with-param name="font_size" select="'0.83em'"/>
  144.   </xsl:call-template>
  145. </xsl:template>
  146.  
  147. <xsl:template mode="l10n.format.mode" match="msg:tt">
  148.   <xsl:param name="node"/>
  149.   <xsl:call-template name="l10n.format.span">
  150.     <xsl:with-param name="node" select="$node"/>
  151.     <xsl:with-param name="font_family" select="'monospace'"/>
  152.   </xsl:call-template>
  153. </xsl:template>
  154.  
  155. <xsl:template mode="l10n.format.mode" match="msg:u">
  156.   <xsl:param name="node"/>
  157.   <xsl:call-template name="l10n.format.span">
  158.     <xsl:with-param name="node" select="$node"/>
  159.     <xsl:with-param name="text_decoration" select="'underline'"/>
  160.   </xsl:call-template>
  161. </xsl:template>
  162.  
  163. </xsl:stylesheet>
  164.